package com.boco.wmworkflow.common.xmlmodel;

import java.util.*;
import com.boco.common.util.xml.AbstractXmlModel;
import com.boco.webmaster.common.xsdmap.workflow.wfstate.*;

public class WfStateXmlModel extends AbstractXmlModel{
    public WfStateXmlModel(String xmlFileName) throws Exception {
        super("com.boco.webmaster.common.xsdmap.workflow.wfstate", xmlFileName);
    }

    private WFStateModelType getXmlRootModel(){
        return (WFStateModelType) super.getRootModel();
    }

    public List getRoleSubState(String roleId, int processType){
        List subStates = new ArrayList();
        for(int i=0; i < getXmlRootModel().getWfStateList().size(); i++){
            WFStateType wfState = (WFStateType)getXmlRootModel().getWfStateList().get(i);
            if(wfState.isIsLoad() && wfState.getRoleId().equals(roleId) &&
                processType == wfState.getProcessType()){
                subStates.add(wfState);
            }
        }
        return subStates;
    }
}
